<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html>
 <head>
<title>月末统计报表</title>
<%@ include file="/common/meta.jsp" %>
<script src="${ctx}/js/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
<script type="text/javascript">
	var basic_Url="${ctx}/logic/Reports";
	var basic_WUrl="/logic/Reports";
	var grid;
//获得表数据
	$(function(){
		grid=$("#table1").ligerGrid({
			columns: [{ display: 'whId', name: 'zdWhId', hide : true },
			          { display: 'whCode', name: 'zdWhCode', hide : true },
			          { display: '物料id', name: 'zdMaterId', hide : true },
			          { display: '编码', name: 'zdMaterCode', width: 100 },
			          { display: '商品名称', name: 'zdMaterName', width: 100 },
			          { display: '规格型号', name: 'zdMaterModel', width: 100 },
			          { display: '规格尺寸', name: 'zdMaterSize', width: 100 },
			          { display: '颜色', name: 'zdMaterColor', width: 100 },
			          { display: '材质', name: 'zdMaterQuanlity', width: 100 },
			          { display: '类别', name: 'zdMaterTypeName', width: 100 },
			          { display: '单位', name: 'zdMaterUnit', width: 100 },
			          { display: '单价', name: 'zdAvgPrice', width: 100 },
			          { display: '期初数量', name: 'zdTaskQuantity', width: 100 },
			          { display: '期初金额', name: 'zdTaskSumMoney', width: 100 },
			          { display: '入库数量', name: 'zdInQuantity', width: 100 },
			          { display: '入库金额', name: 'zdInSumMoney', width: 100 },
			          { display: '出库数量', name: 'zdOutQuantity', width: 100 },
			          { display: '出库金额', name: 'zdOutSumMoney', width: 100 },
			          { display: '期末数量', name: 'zdStockQuantity', width: 100 },
			          { display: '期末金额', name: 'zdStockSumMoney', width: 100 },
			          { display: '单位名称', name: 'zdCompName', width: 160 },
			          { display: '仓库名称', name: 'zdWhName', width: 100 },
			          { display: '系列', name: 'zdMaterSery', width: 100 },
			          { display: 'PI编号', name: 'piCode', width: 100 }
		          ],
                  enabledEdit: true,
                  usePager: false, rownumbers: true, 
                  url:basic_Url+"/endMonthList.do",
                  width: "100%", height:'100%',
                  enabledSort:false
        	});
		$("#pageloading").hide();
	});
	//新建搜索
	function createSearch(){
		init(1, 10, '80,100,80,100,80,100,80,100','5%');
		addCommon(0,4,"lable","时间");
		addCommon(0,5,"inmonth","date");
		addCommon(0,6,"lable","盘点仓库：");
		addCommon(0,7,"selectEnum","whCode","<option></option><c:forEach var="s" items="${whList}"><option value='${s.zd002Code}'>${s.zd003Name}</option></c:forEach>");
	}
	
	function searchAP(){
		if($("#date").val()==null||$("#date").val()==undefined||$("#date").val()==''){
			return;
		}
		if($("#whCode").val()==null||$("#whCode").val()==undefined||$("#whCode").val()==''){
			return;
		}
		multipleSearch("#table1",true,"",basic_Url+"/endMonthList.do?date="+$("#date").val()+"&whCode="+$("#whCode").val());
	}
	
	document.onkeydown=keyListener;   
	function keyListener(e){   
	    e = e ? e : event;  
	    if(e.keyCode == 13){   
	    	searchAP();
	    }   
	} 
	function excelExport(){
		if($("#date").val()==null||$("#date").val()==undefined||$("#date").val()==''){
			return;
		}
	   //	var filtersStr = generateCondition();
	   	//var path = "${ctx}/excel/endMonthExcel.do?filters="+filtersStr+"&_search=true";
	   	var path = "${ctx}/excel/getEndMonthExcel.do?date="+$("#date").val()+"&whCode="+$("#whCode").val();
	   	//alert(path);
		window.open(path,"_blank");
  }
	function inExcel(){
		var url = "/logic/fileUplode/toInPrice.do?date="+$("#date").val();
		ShowIframeDialog("operate","导入单价",url,300,200);
	}
</script>

</head>
<body style="padding:10px" onload="createSearch()">
  <div id="layout1">

          <div id="pageHeader" class="pageHeader">
               <div class="searchBar" id="multipleSearchDialog">
	                <table class="table" width="100%" id="searchHeader" >  
                        <tbody id="newbody">
                        </tbody>
 	                </table>
                    <div class="subBar">
			             <ul>
			             	 <li><a class="button" onclick="excelExport()"><span>导出</span></a></li>
			             	 <li><a class="button" onclick="inExcel()"><span>单价导入</span></a></li>
				             <li><div class="buttonActive"><div class="buttonContent"><button type="submit" id="btnSearch" onclick="searchAP()">查询</button></div></div></li>
				             <li><a class="button" onclick="clearSearch()"><span>重置</span></a></li>
			             </ul>
	                </div>
               </div>
          </div>
      </div>
      <div position="center" id="table1">
      </div>
      <div class="clear"></div>
</body>
</html>